package com.atguigu.yygh.hosp.controller;

import com.atguigu.yygh.common.result.ResultCode;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

/**
 * SYT_Demo02
 * 2022/11/2 17 22
 */
@RestController
@RequestMapping("/admin/hosp/user")
public class UserLoginController {

    /**
     * 用户登录方法（假的）
     * @return
     */
    @PostMapping("/login")
    public ResultCode.R login(){
        return ResultCode.R.ok ().data ("token","admin-token");
    }

    //"roles":["admin"],
    //"introduction":"I am a super administrator",
    //"avatar":"https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif",
    //"name":"Super Admin"

    /**
     * 登录成功后获取到用户的数据（直接给的）
     * @return
     */
    @GetMapping("/info")
    public ResultCode.R userInfo(){
        HashMap<String, Object> hashMap = new HashMap<> ();
        hashMap.put ("roles","admin");
        hashMap.put ("introduction","管理员11");
        hashMap.put ("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        hashMap.put ("name","SYT项目");

        return ResultCode.R.ok ().data (hashMap);
    }

}
